import Vue from 'vue'
import Router from 'vue-router'

import Home from '../views/home/home.vue'
import Demo from '../views/Demo.vue'

Vue.use(Router)

let router = new Router({
  base: process.env.BASE_URL,
  routes: [

    {
      path: '',
      redirect: '/home'
    },
    // 首页列表页
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    // 地图--发现页
    {
      path: '/location',
      name: 'location',
      component: () => import('../views/location')
    },
    // 搜索页
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/search')
    },
    // 订单页
    {
      path: '/order',
      name: 'order',
      component: () => import('../views/order')
    },
    // 购物车
    {
      path: '/car',
      name: 'car',
      component: () => import('../views/car')
    },
    // 店铺
    {
      path: '/shop/:shopid',
      name: 'shop',
      component: () => import('../views/shop'),
      children: []
    },
    // 个人信息页
    {
      path: '/profile',
      name: 'profile',
      component: () => import('../views/profile'),
      children: [{
        path: 'address',
        name: 'address',
        component: () => import('../views/profile/address'),
        children: [{
          path: 'add',
          name: 'addAddress',
          component: () => import('../views/profile/address/add')
        }]
      }]
    },
    // demo
    {
      path: '/demo',
      name: 'demo',
      component: Demo
    }
  ]
})
export default router
